﻿//*********************************************************************
//
//  文件名：DebitController
//
//  作者： Pwp
//
//  作用：扣款模块
//
//  日期：2015-10-14
//
//*********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using Application.WebAPI.Filter;
using YouTravel.DomainService;
using Framework.IOC;
using Framework.Common;
using Framework.Common.Paged;
using YouTravel.QueryModels;
using YouTravel.ViewModels;
using YouTravel.Framework.ResourceMessage;
using YouTravel.DomainModels;
using YouTravel.Framework.Enums;
using Framework.Common.Exceptions;

namespace Application.WebAPI.Controllers
{
	[RoutePrefix("api/debit")]
    public class DebitController : BaseController
    {
		IDebitService debitService;
        DataResult dataResult = new DataResult();
		public DebitController(IDebitService debitService)
            : base()
        {
			this.debitService = debitService;
        }
        /// <summary>
        /// 机构列表
        /// </summary>
        /// <param name="inputBranch"></param>
        /// <returns></returns>
		[Route("debitlist")]
        [HttpPost]
		public DataResult GetBranchList(PagedParam<CollectInvoiceQuery> inputBranch)
        {
			#region 角色验证
			//总公司访问
			if(LoginUser.Type != 0&& LoginUser.Type != UserType.Company ){
				throw new DataOperationPermissions(BusinessResourceMessage.NoPower);
			}
			#endregion

			#region 输入验证
			//if (string.IsNullOrEmpty(inputBranch.QueryDto.Type))
			//	throw new DataValidationException(string.Format(BusinessResourceMessage.ItemCanNotNull, "机构类型"));
			#endregion

			dataResult.Code = ResponseStatusCode.Success;
			dataResult.Msg = BusinessResourceMessage.Success;
			dataResult.Data = debitService.GetList(inputBranch);
			return dataResult;
        }
    }
}